package br.gov.dataprev.treinamento.ejb.modelo;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@DiscriminatorValue("PF")
@Table(name="PESSOAS_FISICAS", uniqueConstraints={@UniqueConstraint(columnNames="NU_CPF")})
public class PessoaFisica extends Cliente {

	private static final long serialVersionUID = 1L;
	
	@Column(name="NU_CPF", length=11, nullable=false)
	private String cpf;
	
	@Column(name="NO_CLIENTE", length=100)
	private String nome;
	
	@Enumerated(EnumType.STRING)
	@Column(name="CS_SEXO")
	private Sexo sexo;

	public PessoaFisica() {
		super();
		// TODO Auto-generated constructor stub
	}

	public String getCpf() {
		return cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Sexo getSexo() {
		return sexo;
	}

	public void setSexo(Sexo sexo) {
		this.sexo = sexo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((cpf == null) ? 0 : cpf.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (!(obj instanceof PessoaFisica))
			return false;
		PessoaFisica other = (PessoaFisica) obj;
		if (cpf == null) {
			if (other.cpf != null)
				return false;
		} else if (!cpf.equals(other.cpf))
			return false;
		return true;
	}
	
	
	
}
